Trò chơi đua xe động vật trong UNITY Engine
114.840 lượt xem;
1 using UnityEngine;
2 using System.Collections;
3 using System.Collections.Generic;
4
5 public class ActionRunnable : Action {
6 public Runnable runnable;
7
8 private bool Ran;
9 public ActionRunnable() { }
10
11 public ActionRunnable(Runnable runnable)
12 {
13 this.runnable = runnable;
14 }
15
16 public void setRunnable(Runnable runnable)
17 {
18 this.runnable = runnable;
19 }
20 public override bool Act(float delta)
21 {
22 if (!Ran)
23 {
24 Ran = true;
25 runnable();
26 }
27 return true;
28 }
29
30 public override void restart()
31 {
32 Ran = false;
33 }
34 }
35
36 public delegate void Runnable();
2 using System.Collections;
3 using System.Collections.Generic;
4
5 public class ActionRunnable : Action {
6 public Runnable runnable;
7
8 private bool Ran;
9 public ActionRunnable() { }
10
11 public ActionRunnable(Runnable runnable)
12 {
13 this.runnable = runnable;
14 }
15
16 public void setRunnable(Runnable runnable)
17 {
18 this.runnable = runnable;
19 }
20 public override bool Act(float delta)
21 {
22 if (!Ran)
23 {
24 Ran = true;
25 runnable();
26 }
27 return true;
28 }
29
30 public override void restart()
31 {
32 Ran = false;
33 }
34 }
35
36 public delegate void Runnable();